package com.lzj.controller;

import com.lzj.entity.Meeting;
import com.lzj.service.MeetingParticipantsService;
import com.lzj.service.MeetingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * <p>
 *
 * </p>
 *
 * @autor:lzj
 * @date:2022/2/26
 */
@Controller
public class NotificationsController {
    @Autowired
    MeetingService meetingService;
    @Autowired
    MeetingParticipantsService meetingParticipantsService;
    @RequestMapping("/notifications/{employeeid}")
    public String notifications(@PathVariable int employeeid, Model model){
        List<Meeting> meetingByMtIdAndSta=null;
        List<Integer> meetingByEmpId = meetingParticipantsService.getMeetingByEmpId(employeeid);
        if(meetingByEmpId!=null&&meetingByEmpId.size()>0){
            meetingByMtIdAndSta = meetingService.getMeetingByMtIdAndSta(meetingByEmpId, employeeid, "1");
        }
        model.addAttribute("meeting",meetingByMtIdAndSta);
        return "notifications";
    }

}
